﻿@namespace ThingsGateway.Debug
@using ThingsGateway.Foundation

<ValidateForm class="p-4 h-100" Model="@ValueTransformConfig" OnValidSubmit="OnSave">
    <EditorForm AutoGenerateAllItem="false" RowType=RowType.Inline ItemsPerRow=1 LabelWidth=150 Model="ValueTransformConfig">

        <FieldItems>

            <EditorItem @bind-Field="@context.TransformType" GroupName=@(ValueTransformConfigLocalizer["TransformType"]) Cols="4" />
            <EditorItem @bind-Field="@context.ClampToRawRange" GroupName=@(ValueTransformConfigLocalizer["TransformType"]) Cols="4" />
            <EditorItem @bind-Field="@context.DecimalPlaces" GroupName=@(ValueTransformConfigLocalizer["TransformType"]) Cols="4" />


            <EditorItem @bind-Field="@context.RawMin" Readonly=@(context.TransformType != ValueTransformType.Linear) GroupName=@(ValueTransformConfigLocalizer["MinMax"]) GroupOrder=2 Cols="6" />
            <EditorItem @bind-Field="@context.RawMax" Readonly=@(context.TransformType != ValueTransformType.Linear) GroupName=@(ValueTransformConfigLocalizer["MinMax"]) GroupOrder=2 Cols="6" />
            <EditorItem @bind-Field="@context.ActualMin" Readonly=@(context.ClampToRawRange == false && context.TransformType != ValueTransformType.Linear) GroupName=@(ValueTransformConfigLocalizer["MinMax"]) GroupOrder=2 Cols="6" />
            <EditorItem @bind-Field="@context.ActualMax" Readonly=@(context.ClampToRawRange == false && context.TransformType != ValueTransformType.Linear) GroupName=@(ValueTransformConfigLocalizer["MinMax"]) GroupOrder=2 Cols="6" />


        </FieldItems>
        <Buttons>
            <Button ButtonType="ButtonType.Submit" Icon="fa-solid fa-floppy-disk" IsAsync Text=@RazorLocalizer["Save"] />
        </Buttons>
    </EditorForm>

</ValidateForm>

